Skip to content

feat: add hostd — desktop WiFi/BLE scanner with WiGLE CSV output#111

Open
dougborg wants to merge 3 commits intomainfrom
feat/hostd
Open

feat: add hostd — desktop WiFi/BLE scanner with WiGLE CSV output#111
dougborg wants to merge 3 commits intomainfrom
feat/hostd

Conversation

@dougborg
Copy link
Copy Markdown
Owner

Summary

  • Host daemon (hostd/) that scans WiFi (CoreWLAN) and BLE (btleplug) on desktop, logging ALL observations in WiGLE CSV v1.6 format with GPS coordinates from CoreLocation
  • macOS .app bundle for Location Services authorization — just bundle-hostd assembles it, just run-hostd launches via the bundle path so the system prompt appears
  • Library changes: security field on WiFiEvent (cfg-gated, no ESP32 DRAM cost), board-host feature with desktop platform constants
  • CI: hostd check/clippy/test job, fmt + audit; pre-commit hook runs hostd tests conditionally

Details

  • WiGLE CSV writer uses csv crate for correct RFC 4180 escaping
  • Observation-based output: every sighting is a row (no dedup), matching WiGLE/Kismet conventions
  • Non-fatal scanner exits: BLE or WiFi dying doesn't kill the daemon
  • Periodic CSV flush (every 5s) balances crash durability with I/O overhead
  • NDJSON match output on stdout preserved for companion app compatibility
  • WiFi scan interval reduced to 1s (effective ~4-6s cycle, dominated by CoreWLAN active scan)

Test plan

  • cargo test — 20 hostd tests pass (wigle writer, BLE converter, MAC parser)
  • cargo clippy -- -D warnings — clean
  • Library tests pass (cargo test --lib --no-default-features)
  • Smoke test: 1200+ observations in 30s (442 WiFi, 766 BLE) with GPS coordinates
  • CI: hostd job passes on ubuntu-latest (BLE dev deps: libdbus-1-dev)
  • Verify ESP32 builds still link (just docker-build) — security field is cfg-gated

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings March 15, 2026 21:47
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a new desktop host daemon (hostd/) that runs WiFi (CoreWLAN) and BLE (btleplug) scanning on desktop platforms, logging all observations in WiGLE CSV v1.6 format with GPS coordinates from CoreLocation. It also makes minimal library changes to support the desktop platform, including a new board-host feature and a cfg-gated security field on WiFiEvent.

Changes:

  • New hostd/ crate with WiFi/BLE scanners, WiGLE CSV writer, CoreLocation GPS integration, and NDJSON match output
  • Library changes: board-host feature flag with desktop platform constants, security field on WiFiEvent (cfg-gated behind not(esp32))
  • CI/tooling: new hostd CI job (check/clippy/test), fmt and audit for hostd, conditional pre-commit hook, and justfile targets

Reviewed changes

Copilot reviewed 14 out of 16 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
hostd/src/main.rs Main daemon: spawns BLE/WiFi scanners, filter task, stdin command loop, WiGLE CSV output
hostd/src/wigle.rs WiGLE CSV v1.6 writer with WiFi/BLE row formatters and comprehensive tests
hostd/src/ble.rs BLE scanner using btleplug, converting peripheral properties to AirHound BleEvents
hostd/src/wifi_macos.rs macOS WiFi scanner using CoreWLAN via wifi_scan crate
hostd/src/location_macos.rs CoreLocation GPS provider for macOS
hostd/Cargo.toml Crate manifest with platform-conditional macOS dependencies
hostd/Cargo.lock Lock file for hostd dependencies
hostd/rust-toolchain.toml Stable Rust toolchain for hostd
hostd/macos/Info.plist macOS app bundle plist for Location Services authorization
src/scanner.rs Added cfg-gated security field to WiFiEvent
src/board.rs Added board-host module with desktop platform constants
Cargo.toml Added board-host feature flag
justfile Added hostd build/run/test/check/clippy/fmt targets
.github/workflows/ci.yml Added hostd CI job, fmt check, and dependency audit
.githooks/pre-commit Conditional test runs for hostd and library changes
.gitignore Added hostd build artifacts

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread hostd/src/ble.rs Outdated
let _ = name.push_str(&local_name[..end]);
}

let rssi = props.rssi.unwrap_or(0) as i8;
dougborg and others added 3 commits March 15, 2026 15:53
Add `security: heapless::String<64>` to WiFiEvent for WiGLE AuthMode
output, cfg-gated behind `not(esp32)` to avoid DRAM cost on ESP32.
Add `board-host` feature with desktop platform constants.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Host daemon that scans WiFi (CoreWLAN) and BLE (btleplug), logs ALL
observations in WiGLE CSV v1.6 format, and emits NDJSON on stdout for
matched surveillance devices. GPS tagging via CoreLocation on macOS.

- BLE scanner via btleplug with CoreBluetooth backend
- WiFi scanner via wifi_scan with CoreWLAN backend
- CoreLocation GPS provider with authorization request
- WiGLE CSV v1.6 writer using csv crate (proper RFC 4180 escaping)
- macOS .app bundle for Location Services permission prompt
- clap CLI with --output flag (defaults to airhound-YYYYMMDD-HHMMSS.csv)
- Non-fatal scanner exits (BLE/WiFi dying doesn't kill the daemon)
- Periodic CSV flush (every 5s) for crash durability

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- CI: hostd check, clippy, test job on ubuntu-latest; fmt and audit
- justfile: build-hostd, bundle-hostd, run-hostd (macOS/Linux),
  check-hostd, test-hostd, fmt-hostd, clippy-hostd recipes
- pre-commit: run hostd tests when hostd/ or src/ changes; make
  library tests conditional on staged src/ files

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 15, 2026

Preview Binaries

Flashable firmware binaries for this PR:

no_std (Embassy)

Artifact Size Download
bin-m5stickc 0.5 MB Download
bin-xiao 0.5 MB Download

std (ESP-IDF)

Artifact Size Download
bin-m5stickc-std 0.8 MB Download
bin-xiao-std 0.8 MB Download

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants